﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Diagnostics;
using System.IO;

using Debug = UnityEngine.Debug;

public class GeneralTestScript : MonoBehaviour
{
    private Stopwatch stopWatch = new Stopwatch();

    void Start()
    {
        //Region region = Region.FindOrCreate(0, 0);

        //Chunk tmpChunk = null;

        //stopWatch.Start();
        //for (int x = 0; x < 32; x++)
        //    for (int z = 0; z < 32; z++)
        //        for (int y = 0; y < 8; y++)
        //        {
        //            tmpChunk = region.GetChunkAt(x << 4, y << 4, z << 4);
        //        }
        //StopDebugResetStopwatch();

        //stopWatch.Start();
        //region.WriteRegionDataToFile();
        //StopDebugResetStopwatch();

        //stopWatch.Start();
        //Region region2 = Region.FindOrCreate(0, 0);
        //StopDebugResetStopwatch();

        //stopWatch.Start();
        //for (int x = 0; x < 32; x++)
        //    for (int z = 0; z < 32; z++)
        //        for (int y = 0; y < 8; y++)
        //        {
        //            tmpChunk = region2.GetChunkAt(x << 4, y << 4, z << 4);
        //        }
        //StopDebugResetStopwatch();

        stopWatch.Start();
        for (int i = 0; i < 1 << 25 ; i++)
        {
            int j = i << 2;
        }
        StopDebugResetStopwatch();

        stopWatch.Start();
        for (int i = 0; i < 1 << 25; i++)
        {
            int j = i * 2 * 2;
        }
        StopDebugResetStopwatch();
    }

    void DebugSomeText()
    {
        Debug.Log("test");
    }

    private void StopDebugResetStopwatch()
    {
        stopWatch.Stop();
        Debug.Log(stopWatch.ElapsedMilliseconds);
        stopWatch.Reset();
    }


}